﻿<sdk:Page x:Class="SampleBrowser.Views.SampleBook" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           mc:Ignorable="d"
           xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
           xmlns:book="clr-namespace:SLMitsuControls;assembly=SLMitsuControls"
           xmlns:doc="http://schemas.firstfloorsoftware.com/documenttoolkit"
           xmlns:sample="http://schemas.firstfloorsoftware.com/documenttoolkit/samplebrowser"
           xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="Book Control">
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <TextBlock x:Name="HeaderText" Style="{StaticResource HeaderTextStyle}" Text="Book Control"/>
        <TextBlock Grid.Row="1" Text="Turn pages with the mouse by dragging any of the page corners" />
        <Grid Grid.Row="2" Margin="8">
            <doc:DocumentDataSource x:Name="DataSource" />
            <book:UCBook x:Name="book" HorizontalAlignment="Center" VerticalAlignment="Center">
                <book:UCBook.Resources>
                    <sample:PageIndexToNumberConverter x:Key="PageIndexToNumberConverter" />
                </book:UCBook.Resources>
                <i:Interaction.Behaviors>
                    <sample:BookBehavior DocumentDataSource="{Binding ElementName=DataSource}"
                                         PageNumber="{Binding PageIndex, Mode=TwoWay, ElementName=Navigator, Converter={StaticResource PageIndexToNumberConverter}}" />
                </i:Interaction.Behaviors>
            </book:UCBook>
        </Grid>
        <StackPanel Grid.Row="3" Margin="0,8,0,0" Orientation="Horizontal" HorizontalAlignment="Center">
            <doc:PageNavigator x:Name="Navigator" PageCount="{Binding Document.PageCount, ElementName=DataSource, FallbackValue=0}" />
            <Button Margin="4,0,0,0" Padding="7">
                <Button.Command>
                    <sample:OpenPdfOrXpsFromDiskCommand DocumentDataSource="{Binding ElementName=DataSource}" />
                </Button.Command>
                <Button.Content>
                    <Image Source="/SampleBrowser;component/Assets/Icons/open.png" />
                </Button.Content>
            </Button>
        </StackPanel>
    </Grid>
</sdk:Page>
